package com.freecloud.javabasics.network.rpc.clent;

import java.lang.reflect.Proxy;

/**
 * @Author: maomao
 * @Date: 2020-03-15 21:38
 */
public class RpcProxyClient {
    public <T> T clientProxy(final Class<T> interfaceCls,final String host,final int port){

        return (T) Proxy.newProxyInstance(interfaceCls.getClassLoader(),new Class<?>[]{interfaceCls},new RemoteInvocationHandler(host,port));

    }
}
